<%@page contentType="text/html;charset=UTF-8"%> 
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

	<link type="text/css" rel="stylesheet" href="../resources/css/bootstrap.min.css" />
	<link type="text/css" rel="stylesheet" href="../resources/css/style.css" />
	<script type="text/javascript" src="../resources/js/jquery.js"></script>
	<script type="text/javascript" src="../resources/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../resources/js/jquery-ui.js"></script>
	<link type="text/css" rel="stylesheet" href="../resources/css/jquery-ui.css" />
	<script>
	
		$(function() {
			$( "#datepicker_edit" ).datepicker({ dateFormat: 'dd-mm-yy' });
		});
	</script>

 
<form action="/QLKhoaCNTT/updatecongvanden" method="post" class="form-horizontal">
	<c:forEach items="${listCongVanForm}" var="congvan">
		<div class="form-group">
			<label for="kyhieuCV" class="col-lg-3 control-label">Ký hiệu công văn</label>
			<div class="col-lg-9">
			<input class="form-control" id="kyhieuCV" name="idcongvan" value="${congvan.idCongVan}" placeholder="Ký hiệu công văn" type="text">
			</div>
		</div><!-- end form-group-->
		
		<div class="form-group">
			<label for="trichYeu" class="col-lg-3 control-label">Trích yếu</label>
			<div class="col-lg-9">
			<textarea class="form-control" rows="3" id="trichYeu" name="trichyeu">${congvan.trichYeu}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="col-lg-3 control-label">File đính kèm</label>
			<div class="col-lg-9">
			<div class="input-group">
			<span class="input-group-btn">
			<span class="btn btn-primary btn-file">
			Browse <input type="file" multiple>
			</span>
			</span>
			<input type="text" name="filedinhkem" value="${congvan.fileDinhKem }" class="form-control">
			</div>
			</div>
		</div>
		
		<div class="form-group">
			<label for="ngayNhan" class="col-lg-3 control-label">Ngày Nhận</label>
			<div class="col-lg-9">
			<input class="form-control" type="text" name="ngaynhan" value="<fmt:formatDate value="${congvan.congvanden.ngayNhan}" pattern="dd-MM-yyyy" />" id="datepicker_edit" placeholder="Ngày Nhận">
			</div>
		</div><!-- end form-group-->
		
		<div class="form-group">
			<label for="noiGui" class="col-lg-3 control-label">Nơi gửi</label>
			<div class="col-lg-9">
			<input class="form-control" id="noiGui" name="noigui" value="${congvan.congvanden.noiGui }" placeholder="Nơi gửi" type="text">
			</div>
		</div><!-- end form-group-->
		<button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
		<button type="submit" class="btn btn-primary">Lưu</button>
	</c:forEach>
</form>
  
			 <input class="form-control" type="text" name="ngaynhan" id="datepicker" placeholder="Ngày Nhận">
<c:if test="${!empty listCongVan}">
	<table class="table table-hover">
		<tr>
			<th width="80">Mã Công Văn</th>
			<th width="80">Trích Yếu</th>
			<th width="120">File Đính Kèm</th>
			<th width="120">Ngày Nhận</th>
			<th width="120">Nơi Gửi</th>
			<th width="80">Sửa</th>
			<th width="80">Xóa</th>
			
		</tr>
		<c:forEach items="${listCongVan}" var="congvan">
			<c:if test="${!empty congvan.congvanden.idCongVanDen}">
			<tr>
		
				<td>${congvan.congvanden.idCongVanDen}</td>
				<td>${congvan.trichYeu}</td>
				<td>${congvan.fileDinhKem}</td>
				<td>${congvan.congvanden.ngayNhan}</td>
				<td>${congvan.congvanden.noiGui}</td>
				<td><a class="btn btn-primary" href="<c:url value='/edit/${congvan.congvanden.idCongVanDen}' />">Sữa</a></td>
				<td><a class="btn btn-primary" href="#">Xóa</a></td>
			 </tr>
			 </c:if>
		</c:forEach>
	</table>
</c:if>

